using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Geoconcepts.SemanticServices;

namespace Geoconcepts.SemanticServices.WebTest
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnExecuteSparql_Click(object sender, EventArgs e)
        {
            QueryEngine svcQueryEngine = new SemanticServices.QueryEngine();
            byte[] baFile = null;
            

            try
            {
                baFile = svcQueryEngine.ExecuteCONSTRUCTOverInferredGraph(txtURI.Text, txtSparql.Text.Replace("\r","").Replace("\n",""));
                //xmlContainer.DocumentContent = System.Text.Encoding.UTF8.GetString(baFile);
                //xmlDataSource.Data = System.Text.Encoding.UTF8.GetString(baFile);
                //xmlContainer.ApplyStyleSheetSkin(this.Page);
                //Response.Flush();
                txtXmlResult.Text = System.Text.Encoding.UTF8.GetString(baFile);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }

        protected void btnGetIndividual_Click(object sender, EventArgs e)
        {
            QueryEngine svcQueryEngine = new SemanticServices.QueryEngine();
            try
            {
                // txtIndividualResult.Text = svcQueryEngine.GetIndividual(txtURI.Text, txtIndividualURI.Text);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }

        protected void btnTestConnection_Click(object sender, EventArgs e)
        {
            //DataAccess svcDataAccess = new DataAccess();
            //lblResultadoTest.Text = svcDataAccess.TestConnection(txtServer.Text, "geoconcepts", txtUsuario.Text, txtPassword.Text);
            
        }
    }
}
